// ETF 相关的 API 请求

import axios from '@/utils/request'

// 获取中位数数据
function median(unit, num) {
  return axios.post(`/etf/median/${unit}/${num}`)
}

function delivery(params = {}) {
  return axios.get('/etf/delivery', { params })
}

// 添加 ETF
function add(code) {
  return axios.post(`/etf/save/${code}`)
}

// 删除 ETF
function remove(code) {
  return axios.post(`/etf/remove/${code}`)
}

// 设置持仓标记
function setHoldFlag(code, flag) {
  return axios.post(`/etf/hold/${code}/${flag}`)
}

function opportunity(type) {
  return axios.post(`/etf/opportunity/${type}`)
}

export { median, delivery, setHoldFlag, remove as etfRemove, add as etfAdd, opportunity }
